import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginReact from 'eslint-plugin-react'
import eslintConfigPrettier from 'eslint-config-prettier'

/** @type {import('eslint').Linter.Config[]} */
export default [
  { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
  { languageOptions: { globals: globals.browser } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  pluginReact.configs.flat.recommended,
  eslintConfigPrettier,
  {
    settings: {
      react: {
        // 自动检测 React 版本
        version: 'detect'
        // 若你想手动指定版本，比如 18.2.0，可以这样写
        // version: '18.2.0' 
      }
    },
    rules: {
      'react/react-in-jsx-scope': 'off', // 禁用 react/react-in-jsx-scope 规则
    },
  },
]
